package tuanvn.iti.vn;

import java.util.List;

import mrtran.iti.vn.Main;
import android.graphics.Bitmap;
import android.graphics.Canvas;

public class SpriteTemp {
	private float x;
	private float y;
	private Bitmap bmp;
	private int life = 15;
	private List<SpriteTemp> temps;

	public SpriteTemp(List<SpriteTemp> temps, Main main, float x, float y,
			Bitmap bmp) {
		this.x = x;
		this.y = y;
		this.bmp = bmp;
		this.temps = temps;
	}

	public void onDraw(Canvas canvas) {
		update();
		canvas.drawBitmap(bmp, x, y, null);
	}

	private void update() {
		if (--life < 1) {
			temps.remove(this);
		}
	}
}